package org.example.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.example.domain.GoodsMaterial;
import org.example.dto.GoodsMaterialDto;
import org.example.result.PageResult;
import org.example.service.GoodsMaterialService;
import org.example.mapper.GoodsMaterialMapper;
import org.example.vo.GoodsMaterialVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 19816
* @description 针对表【a_goods_material】的数据库操作Service实现
* @createDate 2024-05-29 19:47:22
*/
@Service
public class GoodsMaterialServiceImpl implements GoodsMaterialService{

    @Autowired
    private GoodsMaterialMapper goodsMaterialMapper;
    @Override
    public GoodsMaterial queryById(String id) {
        return goodsMaterialMapper.queryById(id);
    }

    @Override
    public PageResult listall(GoodsMaterialDto goodsMaterialDto) {
        PageHelper.startPage(goodsMaterialDto.getPageNum(),goodsMaterialDto.getPageSize());
        Page<GoodsMaterialVo> page = goodsMaterialMapper.listall(goodsMaterialDto);
        return PageResult.builder()
                .recodes(page)
                .total(page.getTotal())
                .build();
    }

}




